package com.kyg.tjtoolmanager.driver;

import com.sun.jna.Structure;
import com.sun.jna.ptr.ByteByReference;

import java.util.Arrays;
import java.util.List;

public class UDevice extends Structure {

    public int init;
    public int fd;
    public int print;
    public int inv_stop;
    public int wridx;
    public int rdidx;
    public int head;
    public int ptr;
    public char chk;
    public ByteByReference pbuf = new ByteByReference();

    UHFRFIDDriver.InventoryTagCallback inv_tag_callback;

    @Override
    public String toString() {
        return "UDevice{" +
                "init=" + init +
                ", fd=" + fd +
                ", print=" + print +
                ", inv_stop=" + inv_stop +
                ", wridx=" + wridx +
                ", rdidx=" + rdidx +
                ", head=" + head +
                ", ptr=" + ptr +
                ", chk=" + chk +
                ", pbuf='" + pbuf.getValue() + '\'' +
                '}';
    }

    public static class ByReference extends UDevice implements Structure.ByReference {}
    public static class ByValue extends UDevice implements Structure.ByValue{}

    @Override protected List getFieldOrder() {
        return Arrays.asList(new String[]{"init","fd","print","inv_stop","wridx","rdidx","head","ptr","chk","pbuf"});
    }

}
